<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
        <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<title>Basic_table</title>
<style type="text/css">
.s{
 display: none;
} 
 #ie{
display: none;
} 
#ty{
display: none;
}
#wd{
display: none;
}
#ju{
display: none;
}
.wrapper{
    margin-left: -140px;
   
}
#s{
display: none;
}
</style>



</head>
<body>
<section id="container">
<!--header start-->


<!--sidebar end-->
<!--main content start-->
<section id="main-content" class="manager">
	<section class="wrapper">
		<div class="table-agile-info">
 <div class="panel panel-default">
    <div class="panel-heading">
       项目列表
    </div>
    <div>
      <table class="table" id="t" ui-jq="footable" ui-options='{
        "paging": {
          "enabled": true
        },
        "filtering": {
          "enabled": true
        },
        "sorting": {
          "enabled": true
        }}'>
       
        
      </table>
    </div>
  </div>
</div>
		
		
</section>

 

</section>

<!--main content end-->
</section>


  <div class="container">
 
  <!-- 按钮：用于打开模态框 -->
   
  <!-- 模态框 -->
  <div class="modal fade" id="myModal">
    <div class="modal-dialog modal-lg">
      <div class="modal-content">
   
        <!-- 模态框头部 -->
        <div class="modal-header">
          <h4 class="modal-title">客户信息</h4>
          <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>
   
        <!-- 模态框主体 -->
        <div class="modal-body">
         <span>公司名称</span>
            <div class="card bg-light text-dark">
    <div class="card-body" id="m"></div>
  </div><br>
         <span>公司地址</span>
            <div class="card bg-light text-dark">
    <div class="card-body" id="d"></div>
  </div><br>
    <span>公司介绍</span>
  <div class="card bg-light text-dark">
    <div class="card-body" id="j"></div>
  </div><br>
   <span>联系方式</span>
            <div class="card bg-light text-dark">
    <div class="card-body" id="x"></div>
  </div><br>
  
        </div>
   
        <!-- 模态框底部 -->
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
        </div>
   
      </div>
    </div>
  </div>
  
</div>
  
 
 <div class="container">
  
  
 
   
  
		   
		  <!-- 模态框 -->
		  <div class="modal fade" id="Modal">
		    <div class="modal-dialog modal-lg">
		      <div class="modal-content">
		          
		        <!-- 模态框头部 -->
		        <div class="modal-header">
		          <h4 class="modal-title" id="title"></h4>
		          <button type="button" class="close" data-dismiss="modal">&times;</button>
		        </div>
		   
		        <!-- 模态框主体 -->
		        <div class="modal-body">
		       <span id="wd"></span>
		       <span id="s"></span>
					 <span>开始时间</span>
		         <div class="card">
		            <div class="card-body" id="time"></div>
		          </div>
				  <h5 id="moone"></h5>
				   <div class="progress" style="height:20px;">
				      <div class="progress-bar"  id="one" style="width:70%"></div>
				    </div>
					<h5 id="motow"></h5>
					 <div class="progress" style="height:20px;">
					    <div class="progress-bar" id="tow" style="width:70%"></div>
					  </div>
                    <h5 id="mothree"></h5>
					   <div class="progress" style="height:20px;">
					      <div class="progress-bar" id="three" style="width:70%"></div>
					    </div >
						<h5 id="mofour"></h5>
						 <div class="progress" style="height:20px;">
						    <div class="progress-bar" id="four" style="width:70%"></div>
						  </div>
						 <h5 id="mofive"></h5>
						   <div class="progress" style="height:20px;">
						      <div class="progress-bar" id="five" style="width:70%"></div>
						    </div>
							<span>结束时间</span>
							<div class="card">
							   <div class="card-body" id="etime"></div>
							 </div>
							 <span>项目经理</span>
							 <div class="card">
							    <div class="card-body" id="name"></div>
							  </div>
		        </div>
		   
		        <!-- 模态框底部 -->
		        <div class="modal-footer">
		          <button type="button" class="btn btn-secondary" data-dismiss="modal" onClick="hu()">关闭</button>
				  <button type="button" class="btn btn-outline-primary" data-toggle="modal" data-dismiss="modal" data-target="#odal" onClick="gdu()">查看bug</button>
		        </div>
		   
		      </div>
		    </div>
		  </div>
  
</div>
             <div class="container">
				  <div class="modal fade" id="odal">
				    <div class="modal-dialog modal-lg">
				      <div class="modal-content">
				   
				        <!-- 模态框头部 -->
				        <div class="modal-header">
				          <h4 class="modal-title" id="tit"></h4>
				          <button type="button" class="close" data-dismiss="modal">&times;</button>
				        </div>
				   
				        <!-- 模态框主体 -->
				        <div class="modal-body">
				                  
				                     <table class="table table-hover" id="agf">
    
  </table>
				                   
				        </div>
				        <div class="modal-footer">
				          <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
				            <!-- <button type="button" class="btn btn-outline-info" onClick="updata()">提交</button> -->
				        </div>
				   
				      </div>
				    </div>
				  </div>
				  
				</div>

  
<script src="js/jquery-3.3.1.min.js"></script>


<script type="text/javascript">
proAll();
function proAll(){
	$.ajax({
		type:"post",
		url:"pll",
		data:{},
		success:function(data){
			console.log(data);
			var Str = "";
			 
			 for (var i = 0; i < data.length; i++) {
				Str += "<tr><td id='ty'>"+data[i].p_id+"</td>";
				Str += "<td><a href='#' onClick='kehu(this)' data-toggle='modal' data-target='#myModal'>"+data[i].c_name+"</a></td>";
				Str += "<td>"+data[i].p_name+"</td>";
				Str += "<td>"+data[i].uname+"</td>";
				
				Str += "<td>"+data[i].p_number+"</td>";
				Str += "<td>"+data[i].p_price+"</td>";
				Str += "<td>"+data[i].p_priority+"</td>";
				Str += "<td><a href='#' onClick='jindu(this)' data-toggle='modal' data-target='#Modal'>"+data[i].p_state+"</a></td>";
				
			
			}
			 var tht="<tr><th>客户名称</th><th>项目名称</th><th>项目经理</th><th>开发人数</th><th>奖金</th><th>优先级</th><th>情况</th></tr>";
			$("#t").empty().append(tht).append(Str); 
	 
		}
		
	})
}
function kehu(name){
	var cName=name.parentNode.parentNode.children[1].innerText;
	
	
	
	$.ajax({
		type:"post",
		url:"cdan",
		data:{cName},
		success:function(data){
			console.log(data);
			console.log(data[0].c_adderss);
			$("#m").text(cName);
			$("#d").text(data[0].c_adderss);
			$("#j").text(data[0].c_introduce);
			$("#x").text(data[0].c_home);
		}
		
	})
}
function jindu (btn){
	var id=btn.parentNode.parentNode.children[0].innerText;
	console.log(id);
	$("#s").text(id);
	$.ajax({
		type:"post",
		url:"jindu",
		data:{id},
		success:function(data){
			console.log(data)
			
			$("#wd").text(data[0].m_id)
			$("#one").width(data[0].m_progressone)
			$("#one").text(data[0].m_progressone);
			$("#tow").width(data[0].m_progresstow)
			$("#tow").text(data[0].m_progresstow);
			$("#three").width(data[0].m_progressthree)
			$("#three").text(data[0].m_progressthree);
			$("#four").width(data[0].m_progressfour)
			$("#four").text(data[0].m_progressfour);
			$("#five").width(data[0].m_progressfive)
			$("#five").text(data[0].m_progressfive);
			$("#title").text(data[0].p_name);
			$("#time").text(data[0].p_date);
			$("#etime").text(data[0].p_gdata);
			$("#moone").text(data[0].m_one);
			$("#motow").text(data[0].m_tow);
			$("#mothree").text(data[0].m_therr);
			$("#mofour").text(data[0].m_four);
			$("#mofive").text(data[0].m_five);
			$("#name").text(data[0].uname);
			
		}
	})
	
	
}	

function hu(){
	var mId=$("#s").text();
	var one=$("#one").text();
	var tow=$("#tow").text();
	var three=$("#three").text();
	var four=$("#four").text();
	var five=$("#five").text();
	console.log(mId)
	
	var project={
		 	pId:mId,
		 	pState:"已完成"
		 }
if(one=="100%" && tow=="100%" && three=="100%" && four=="100%" && five=="100%"){
		 	 $.ajax({
		 		type:"post",
		 		url:"pro",
		 		data:JSON.stringify(project),
		 		contentType:"application/json;charset=utf-8",
		 		success:function(data){
		 			console.log(data)
		 			proAll();
		 		}
		 	}) 
		 	
		 }else{
		 	return false;
		 }  
}
function gdu(){
	
    var id=$("#s").text();
	console.log(id)
   
$.ajax({
	type:"post",
	url:"fr",
	data:{id},
	success:function(data){
	console.log(data);
	var st="";
	for (var i = 0; i < data.length; i++){
		st+="<tr><td>"+data[i].b_theme+"</td>";
		st+="<td>"+data[i].b_platform+"</td>";
		st+="<td>"+data[i].b_labor+"</td>";
		st+="<td>"+data[i].b_level+"</td>";
		st+="<td>"+data[i].b_tm+"</td>";
		st+="<td>"+data[i].b_man+"</td>";
		st+="<td>"+data[i].p_name+"</td>";
		st+="<td>"+data[i].b_mod+"</td></tr>";
		
	}
	var th="<tr><th>bug内容</th><th>平台</th><th>研发分工</th><th>程度</th><th>测试机型</th><th>测试人员</th><th>项目</th><th>模块</th>";
	$("#agf").empty().append(th).append(st);
	
	
	}
	}) 
	
	
}

function updata(){
	var mId=$("#ju").text();
	var mProgressone=$("#os").val();
 var mProgresstow=$("#ts").val();
 var mProgressthree=$("#ths").val();
 var mProgressfour=$("#fs").val();
 var mProgressfive=$("#fis").val();
 
 var Modular={
 		mId:mId,
 		mProgressone:mProgressone,
 		mProgresstow:mProgresstow,
 		mProgressthree:mProgressthree,
 		mProgressfour:mProgressfour,
 		mProgressfive:mProgressfive
 				
 }
 
 $.ajax({
 	type:"post",
 	url:"update",
 	data:JSON.stringify(Modular),
		contentType:"application/json;charset=utf-8",
		success:function(data){
			console.log(data)
			if(data.status=="success"){
				
				alert("提交成功");
				$("#odal").modal("hide");
				
			}else{
				alert("提交失败");
			}
		}
 })
 
}


</script>

</body>
</html>